<template>
  <div>
    <r-table :tableHandles="tableHandles" :isSelection="false" :isIndex="false" :isPagination="true"
      :tableData="tableData" :tableCols="tableCols" :tablePage="tablePage" :isHandle="true"
      @refresh="init">
    </r-table>
    <!--    <r-form :formRules="formRules" :formHandle="formHandle" :formData="formData" :formCols="formCols" ref="elForm" labelWidth="200px" dialogWidth="1000px" :isHandle="true" />-->
  </div>
</template>
<script>
// import { order_list } from '@/mock/modules/sys-chargingPile'
import charging_pile_record from './charging_pile_record'
export default {
  data() {
    return {
      searchData: {
        deviceType: '3',
        sn: '',
        oprType: '',
        result: '',
        phone: '',
        orderNo: ''
      },

      tableHandles: [
        // {
        //   label: "导出数据",
        //   type: "primary",
        //   handle: e => this.elFormVisible()
        // }
      ],
      tableData: [],
      tableCols: [

        {
          label: '付款方式',
          prop: 'payManner',
        },

        {
          label: '用户信息',
          prop: 'userName'
        },
        {
          label: '地址',
          prop: 'address',
        },
        {
          label: '设备信息',
          prop: 'sn'
        },
        {
          label: '开始时间',
          prop: 'ctime'
        },
        {
          label: '结束时间',
          prop: 'ftime'
        },
        {
          label: '消费单号',
          prop: 'id'
        },
        {
          label: '交易单号',
          prop: 'payId'
        },
        {
          label: '订单金额',
          prop: 'payMoney'
        },
      ],
      tablePage: { limit: 10, page: 1, total: 34 }
    }
  },
  components: {},
  computed: {},
  mounted() {
    this.init()
  },
  methods: {
    async init(obj = { page: 1 }) {
      // let res = await this.$http.get('/sys/chargingPile/orderList')
      // // console.log("res------", res);
      // this.tablePage.total = res.page.total
      // let charging_pile_record = res.page.list

      if (obj.page === 1) {
        this.tableData = charging_pile_record.slice(0, 10)
      } else if (obj.page === 2) {
        this.tableData = charging_pile_record.slice(10, 20)
      } else if (obj.page === 3) {
        this.tableData = charging_pile_record.slice(20, 30)
      } else if (obj.page === 4) {
        this.tableData = charging_pile_record.slice(30, 40)
      }
    }
    // async elFormSubmit() {
    //   this.formData.state = this.formData.status == true ? 1 : 2
    //   if (this.formData.id) {
    //     let res = await this.api.packupdate(this.formData)
    //     if (res) {
    //       this.formData.id = ''
    //       this.elFormVisible()
    //       this.init()
    //     }
    //   } else {
    //     let res = await this.api.packadd(this.formData)
    //     if (res) {
    //       this.elFormVisible()
    //       this.init()
    //     }
    //   }
    // },
    // async changestate(id) {
    //   let res = await this.api.packchange({ id })
    //   if (res) {
    //     this.init()
    //   }
    // },
    // elFormDetail(row) {
    //   console.log(row);
    //   Object.keys(this.formData).forEach(key => {
    //     this.formData[key] = row[key]
    //   })
    //
    //   this.formData.status=row['state']==1?true:false
    //   this.formData.id = row.id;
    //   // if (this.formCols[1].label == '登录密码') {
    //   //     this.formCols.splice(1, 1)
    //   // }
    //
    //   this.elFormVisible()
    // },
  }
}
</script>
<style scoped lang="scss">
.el-icon-search {
  margin-right: 10px;
}

.Tip {
  margin-left: 20px;
}
</style>
